
#pragma once

#include <vector>

class Solution3
{
public:
	int removeDuplicates(std::vector<int>& nums)
	{
		if (nums.size() <= 2)
			return (int)nums.size();

		int index = 1;
		for (int i=2; i<nums.size(); ++i)
		{
			if (nums[index - 1]!=nums[i])
				nums[++index] = nums[i];
		}
		return index+1;
	}
};